package com.zbkj.dal.pojo.response;

import com.zbkj.dal.entity.merchant.Merchant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class MerchantAddressVO {

    @ApiModelProperty(value = "商户名称")
    private String name;

    @ApiModelProperty(value = "商户姓名")
    private String realName;

    @ApiModelProperty(value = "商户手机号")
    private String phone;

    @ApiModelProperty(value = "省")
    private String province;

    @ApiModelProperty(value = "市")
    private String city;

    @ApiModelProperty(value = "区")
    private String district;

    @ApiModelProperty(value = "商户详细地址")
    private String addressDetail;

    @ApiModelProperty(value = "纬度")
    private String latitude;

    @ApiModelProperty(value = "经度")
    private String longitude;

    @ApiModelProperty("全地址信息")
    private String getFullAddress() {
        return province + city + district + addressDetail;
    }

    public static MerchantAddressVO buildByMerchant(Merchant merchantAddress) {
        MerchantAddressVO merchantAddressVO = new MerchantAddressVO();
        merchantAddressVO.setName(merchantAddress.getName());
        merchantAddressVO.setRealName(merchantAddress.getRealName());
        merchantAddressVO.setPhone(merchantAddress.getPhone());
        merchantAddressVO.setProvince(merchantAddress.getProvince());
        merchantAddressVO.setCity(merchantAddress.getCity());
        merchantAddressVO.setDistrict(merchantAddress.getDistrict());
        merchantAddressVO.setAddressDetail(merchantAddress.getAddressDetail());
        merchantAddressVO.setLatitude(merchantAddress.getLatitude());
        merchantAddressVO.setLongitude(merchantAddress.getLongitude());
        return merchantAddressVO;
    }
}
